package com.example.demo.controller;

import com.example.demo.entity.Pm25;
import com.example.demo.model.FeedBack;
import com.example.demo.service.Pm25Service;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.List;

/**
 * Created by Administrator on 2017/12/12.
 */
@Controller
public class pageController {
    @Autowired
    private Pm25Service pm25Service;

    @RequestMapping("/")
    public String index(Model model){
        return "index";
    }

    @RequestMapping("/test")
    @ResponseBody
    public FeedBack test(@RequestParam("id") String id){
        List<Pm25> list =  pm25Service.selectPm25(id);
        FeedBack feedBack = new FeedBack(200,"yes",list);
        return feedBack;
    }
}
